package main

import (
	"fmt"
	"math/rand"
)

func chengFabiao() {
	for i := 1; i < 10; i++ {
		for j := 1; j <= i; j++ {
			fmt.Printf("%v*%v=%v\t", j, i, j*i)
		}
		fmt.Println()
	}
}

func list01() {
	s01 := []int{}
	for len(s01) < 20 {
		res01 := rand.Intn(20)
		if res01 != 0 {
			s01 = append(s01, res01)
		}
	}
	fmt.Println(s01)
	sum := 0
	multi := 1
	for i := 0; i < len(s01); i++ {
		if i&1 == 0 {
			sum += s01[i]
		} else if i&1 == 1 {
			multi = s01[i] * multi
		}
	}
	fmt.Println(sum)
	fmt.Println(multi)
}

func feb01() {
	feb := []int{}
	for range 2 {
		res := rand.Intn(100)
		feb = append(feb, res)
	}
	fmt.Println(feb)
	for range 5 {
		feb = append(feb, feb[len(feb)-1]+feb[len(feb)-2])
	}
	fmt.Println(feb)
}

func main() {
	chengFabiao()
	list01()
	feb01()
}
